package com.example.lxc415billiards.service.impl;

import com.example.lxc415billiards.domain.OrderGoods;
import com.example.lxc415billiards.mapper.OrderGoodsMapper;
import com.example.lxc415billiards.service.OrderGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderGoodsServiceImpl implements OrderGoodsService {

    @Autowired
    private OrderGoodsMapper orderGoodsMapper;

    @Override
    public List<OrderGoods> getAllOrderGoods() {
        return orderGoodsMapper.selectAllOrderGoods();
    }

    @Override
    public OrderGoods getOrderGoodsById(int orderGoodsId) {
        return orderGoodsMapper.selectOrderGoodsById(orderGoodsId);
    }

    @Override
    public OrderGoods addOrderGoods(OrderGoods orderGoods) {
        orderGoodsMapper.insertOrderGoods(orderGoods);
        return orderGoods;
    }

    @Override
    public void deleteOrderGoodsById(int orderGoodsId) {
        orderGoodsMapper.deleteOrderGoodsById(orderGoodsId);
    }

    @Override
    public OrderGoods updateOrderGoods(OrderGoods orderGoods) {
        orderGoodsMapper.updateOrderGoods(orderGoods);
        return orderGoods;
    }
}
